//
//  HDAboutUsVC.m
//  HDSmartPenSDKDemo
//
//  Created by 牛的mini on 2016/12/26.
//  Copyright © 2016年 牛的mini. All rights reserved.
//

#import "HDAboutUsVC.h"
#import "HDWebviewVC.h"

@interface HDAboutUsVC ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *myTableView;
@property (nonatomic, strong) NSArray *dataArray;
@property (nonatomic, strong) NSArray *iconArray;
@property (nonatomic, assign) NSInteger selectIndex;

@end

@implementation HDAboutUsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    _myTableView.dataSource = self;
    _myTableView.delegate   = self;
    _myTableView.rowHeight = 50.0f;
    _myTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    
    self.title = @"更多";
    _dataArray = @[@"版本号",@"关于我们",@"帮助须知",@"出品团队"];
    _iconArray = @[@"mine_version",@"mine_about_us",@"mine_help",@"mine_group"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ return _dataArray.count; }

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger nowRow = indexPath.row;
    static NSString *identifier = @"HDAboutUsVCCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.textLabel.text = _dataArray[nowRow];
    cell.imageView.image = [UIImage imageNamed:_iconArray[nowRow]];
    if (nowRow == 0)
        cell.detailTextLabel.text = @"V1.4   ";
    else
    {
        UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
        imgView.image = [UIImage imageNamed:@"cell_next"];
        imgView.contentMode = UIViewContentModeCenter;
        cell.accessoryView = imgView;
        cell.detailTextLabel.text = nil;
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    if (indexPath.row == 0)
        return;
    
    _selectIndex = indexPath.row;
    [self performSegueWithIdentifier:@"HDAboutUsVCPushToWebLine" sender:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    HDWebviewVC *VC = segue.destinationViewController;
    VC.title = _dataArray[_selectIndex];
    VC.webPath = @"";
}

- (void)dealloc
{
    self.dataArray = nil;
    self.iconArray = nil;
}
    
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}



@end
